package com.example.demo.dao;

import com.example.demo.bean.Department;
import com.example.demo.bean.Message;
import com.example.demo.bean.Time;
import com.example.demo.bean.Warehouse;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SelectDao {
    /*查询*/
    @Select("select * from department")
    List<Department> department();

    /*查询*/
    @Select("SELECT * FROM message WHERE Hospital = #{Hospital}")
    List<Message> Message(String hospital);


    @Select("SELECT\n" +
            "\ts.department1,\n" +
            "\tt.Hospital,\n" +
            "\tt.Patient,\n" +
            "\tt.State,\n" +
            "\tt.record,\n" +
            "\tt.`name`,\n" +
            "\tt.old,\n" +
            "tt.operation,tt.time1\n" +
            "FROM\n" +
            "\tmessage t\n" +
            "JOIN dmt ts ON t.id = ts.d_id\n" +
            "JOIN department s ON s.d_id = ts.d_id\n" +
            "JOIN timeaxis tt ON  tt.t_id = ts.t_id\n" +
            "WHERE\n" +
            "\tt.Hospital = #{Hospital}"
    )
    List<Message> sel(String Hospital);

    /*查询*/
    @Select("select * from  timeaxis where Hospital=#{Hospital}")
    List<Time> time(String Hospital);

    /*查询*/
    @Select("select * from warehouse where id = #{id}")
    List<Warehouse> warehouse(int id);

}
